#ifndef __BASE_BASE_H__
#define __BASE_BASE_H__

#include "windefine.h"
#include <vector>
#include <list>

using namespace std;

//#define IN
//#define OUT

#ifndef SAFE_DEL
#define SAFE_DEL(p)	\
	if (p)			\
	{				\
		delete p;	\
		p = 0;		\
	}
#endif //SAFE_DEL

template< class T >
inline void SAFE_DEL_VECTOR(vector< T* >& rV)
{
	for (unsigned int i=0; i<rV.size(); ++i)
	{
		SAFE_DEL(rV[i]);
	}
	rV.clear();
}

template< class T >
inline void SAFE_DEL_LIST(list< T* >& rL)
{
	if (!rL.empty())
	{
		typename list< T* >::iterator it = rL.begin();
		T* pElement = 0;
		for (; it!=rL.end(); ++it)
		{
			pElement = *it;
			if (pElement)
			{
				delete pElement;
				pElement = 0;
			}
		}
		rL.clear();
	}
}

#endif //__BASE_BASE_H__
